package com.joseph.websocket.test;

import com.joseph.websocket.component.ServerIdInitializer;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = "classpath:app.xml")
public class Junit {

    @Autowired
    private ServerIdInitializer serverIdInitializer;

    @Test
    public void test01() {
//        for (int i = 0; i < 5; i++) {
//            new Thread(new Runnable() {
//                @Override
//                public void run() {
//                    System.out.println(Thread.currentThread() +"-" + serverIdInitializer.getServerId());
//                }
//            }).start();
//        }

        System.out.println(Thread.currentThread() + "-" + serverIdInitializer.getServerId());

        while (true) {

        }
    }
}